﻿@model FinalProject.Web.ViewModels.CreateUserViewModel

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>CreateUserViewModel</legend>

        @Html.HiddenFor(model => model.UserId)

        <div class="editor-label">
            @Html.LabelFor(model => model.Comment)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Comment)
            @Html.ValidationMessageFor(model => model.Comment)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Password)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UserName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UserName)
            @Html.ValidationMessageFor(model => model.UserName)
        </div>

         <div class="editor-label">
            @Html.LabelFor(model => model.Companies)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(m => m.CompanyId, Model.Companies.Select(option => new SelectListItem
            {
                Text = (option == null ? "None" : option.Name),
                Value = option.Id.ToString(),
                Selected = (Model != null) && (option.Id == Model.CompanyId)
            }), "Choose...")
            @Html.ValidationMessageFor(model => model.Companies)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UserRoles)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UserRoles)
            @Html.ValidationMessageFor(model => model.UserRoles)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
